package com.dgshanger.sanhxiaofeisc.mvp.presenter

import com.dgshanger.sanhxiaofeisc.entity.CommentDetailsEntity
import com.dgshanger.sanhxiaofeisc.mvp.contract.CommentDetailsContract
import com.dgshanger.sanhxiaofeisc.mvp.model.CommentDetailsModel
import com.xx.baseuilibrary.mvp.BaseMvpPresenter
import com.xx.baseutilslibrary.network.rx.XxBaseHttpObserver

/**
 * Created by JacobHHH on 2018/4/20.
 */
class CommentDetailsPresenter : BaseMvpPresenter<CommentDetailsContract.Model, CommentDetailsContract.View>(), CommentDetailsContract.Presenter {

    override fun loadData(comment_id: String?) {
        getModel().loadData(comment_id,object : XxBaseHttpObserver<CommentDetailsEntity>(){

            override fun onCompleted(msg: String?, entity: CommentDetailsEntity?) {
                getView()?.setData(entity)
            }

            override fun onError(error: String?) {
                getView()?.showToast(error)
                getView()?.onDataFailure(error)
            }

            override fun onStart() {

            }

            override fun onFinish() {

            }

        })
    }

    override fun createModel(): CommentDetailsContract.Model = CommentDetailsModel()
}